package org.mmtk.plan.scale.utils;

import org.mmtk.utility.Log;
import org.mmtk.vm.Lock;
import org.mmtk.vm.VM;
import org.vmmagic.pragma.Uninterruptible;

@Uninterruptible  
public class ScaleLogger {
	private static Lock logLock = VM.newLock("logLock");
	
	public static void acquireLogLock() {
		logLock.acquire();
	}
	
	public static void releaseLogLock() {
		logLock.release();
	}
	
	public static void logConcMessage(String message) {
		acquireLogLock();
	
		Log.prependThreadId();
		Log.writeln(message);
		Log.flush();
		
		releaseLogLock();
	}
}
